package cn.cloudtogo.client;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;

import javax.annotation.PostConstruct;

@ConfigurationProperties("gendb.client")
@Data
@Slf4j
public class GendbClientProperties {

    public static final String GENDB_URL = "${gendb.server.host:gendb}:${gendb.server.port:8080}";

    private String host;
    private int port;

    public GendbClientProperties(String host, int port) {
        this.host = host;
        this.port = port;
    }

    @PostConstruct
    public void print() {
        log.info("[load gendb mysql client config. remote server address {}]", String.format("%s:%s", host, port));
    }
}
